import {
  request
} from '../../request/index.js'

Page({

  /**
   * 页面的初始数据
   */
  data: {
    swiperList: [],
    catitems:[],
    floorList:[]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    //获取轮播图数据
    this.getSwiperImg()
    //获取分类导航栏数据
    this.getCatitems()
    //获取楼层数据
    this.getfloorList()

  },

  //获取轮播图数据
  getSwiperImg() {
    request({url:"/home/swiperdata"})
      .then(res => this.setData({
        swiperList: res.data.message
      }))
  },
  //获取分类导航栏数据
  getCatitems() {
    request({url:"/home/catitems"})
      .then(res => this.setData({
        catitems: res.data.message
      }))
  },
  //获取楼层数据
  getfloorList() {
    request({url:"/home/floordata"})
      .then(res => this.setData({
        floorList: res.data.message
      }))
  },
  goGoodsListPage(event){
    const { url } = event.currentTarget.dataset
    const result = url.slice(18)
    wx.navigateTo({
      url: '/pages/goods_list/goods_list?' + result,
    });
  },
})